package com.ict.web.task;

import com.ict.common.utils.StringUtils;
import com.ict.framework.manager.AsyncManager;
import com.ict.system.mapper.SysUserRoleMapper;
import com.ict.web.mapper.AnnualProjectPlanMapper;
import com.ict.web.mapper.ProjectManagementMapper;
import com.ict.web.msg.mapper.SysMsgMapper;
import com.ict.web.service.IAnnualProjectPlanService;
import com.ict.web.service.IApprovalService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 定时任务调度 刷新状态
 *
 * @author YobertJomi
 */
@Component("refreshStatusTask")
public class RefreshStatusTask {


    @Resource
    private IAnnualProjectPlanService annualProjectPlanService;

    @Resource
    private AnnualProjectPlanMapper annualProjectPlanMapper;

    @Resource
    private ProjectManagementMapper projectManagementMapper;

    @Resource
    private IApprovalService approvalService;

    @Resource
    private SysUserRoleMapper sysUserRoleMapper;

    @Resource
    private SysMsgMapper sysMsgMapper;

    protected Logger logger = LoggerFactory.getLogger(getClass());

    public void refreshStatusMultipleParams(String s, Boolean b, Long l, Double d, Integer i) {
        System.out.println(StringUtils.format("执行多参方法： 字符串类型{}，布尔类型{}，长整型{}，浮点型{}，整形{}", s, b, l, d, i));
    }

    public void refreshStatusParams(String params) {
        System.out.println("执行有参方法：" + params);
    }

    public void refreshStatusNoParams() {
        System.out.println("执行无参方法");
    }

    public void refreshStatus() {
        logger.error("执行定时任务调度 刷新年度计划状态");
        AsyncManager.me().execute(RefreshStatusAsyncFactory.asyncStatus(annualProjectPlanService,
                annualProjectPlanMapper,
                projectManagementMapper,
                approvalService,
                sysUserRoleMapper,
                sysMsgMapper));
    }
}
